<template>
  <view class="box">
    <template v-if="isShow">
      <view class="title"> {{ newInfo.title }}</view>
      <view class="info">
        <view class="news_cneter">{{
          newInfo.company_name ? newInfo.company_name : "锦龙汽车集团"
        }}</view>
        <view class="news_date">{{ newInfo.activity_time | dateMimute }}</view>
      </view>
      <uParse :content="newInfo.content" :previewImg="true"></uParse>
    </template>
    <view style="height: 60rpx"></view>
  </view>
</template>

<script>
import uParse from "@/News/components/u-parse/u-parse.vue";
import { newsDetailApi } from "@/API/reqNews";
export default {
  components: {
    uParse,
  },
  data() {
    return {
      baseUrl: this.$baseUrl,
      newInfo: {},
      isShow: false,
    };
  },
  onLoad(options) {
    this.getNewsDetail(options.item);
  },
  methods: {
    async getNewsDetail(id) {
      const {
        data: { data },
      } = await newsDetailApi({ id });
      this.newInfo = data;
      this.isShow = true;

      if (this.newInfo.type == 2) {
        this.shareMixin.title = `ZEEKR活动`;
        wx.setNavigationBarTitle({ title: `活动详情` });
      } else {
        this.shareMixin.title = `新闻列表`;
      }
      this.shareMixin.path = `/News/NewsDetails`;
      this.shareMixin.query = `item=${id}`;
    },
  },
};
</script>

<style>
.ql-align-center {
  text-align: center !important;
}

image {
  width: 100% !important;
  display: block;
}
</style>
<style scoped lang="scss">
.box {
  padding: 0rpx 20px;

  .title {
    font-size: 22px;
    color: #222222;
    font-weight: 600;
  }

  img {
    margin: 0;
  }

  .info {
    font-size: 15px;
    color: #999;

    .news_cneter {
      line-height: 58rpx;
      color: #576b95;
    }

    margin-bottom: 36rpx;
  }
}
</style>
